﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MusicExplorer.Model
{
    public sealed class Track : Entity, IEntityFriendlyName
    {
        private readonly Dictionary<ArtistRole, List<Artist>> m_artists;

        public Track()
        {
            m_artists = new Dictionary<ArtistRole, List<Artist>>();
        }

        public string Name { get; set; }
        public string Url { get; set; }
        public string Mp3 { get; set; }
        public string SmallArtwork { get; set; }
        public string BigArtwork { get; set; }
        public DateTime ReleaseDate { get; set; }

        public string DisplayName
        {
            get { return Name; }
        }

        #region Artists
        public Dictionary<ArtistRole, List<Artist>> Artists { get { return m_artists; } }
        public bool HasArtistRole(ArtistRole role)
        {
            return m_artists.ContainsKey(role);
        }
        public List<Artist> this[ArtistRole role]
        {
            get
            {
                if(HasArtistRole(role))
                {
                    return m_artists[role];
                }
                else
                {
                    return null;
                }
            }
        }
        #endregion
    }
}
